package com.hspedu.tankgame03;

public class HeroTank extends Tank {
    Shot shot = null;

    public HeroTank(int x, int y) {
        super(x, y);
    }

    public void shotEnemyTank() {
        //创建子弹对象
        switch (getDirect()){ //Hero的方向
            case 0:
                shot = new Shot(getX()+20, getY(), 0);
                break;
            case 1:
                shot = new Shot(getX()+60, getY()+20, 1);
                break;
            case 2:
                shot = new Shot(getX()+20, getY()+60, 2);
                break;
            case 3:
                shot = new Shot(getX(), getY()+20, 3);
                break;
        }
        //启动shot线程
        new Thread(shot).start();
    }
}
